package rad.framework.mda.generator.template.main.java.seam;

import java.util.*;
import rad.framework.mda.generator.util.*;
import org.eclipse.uml2.uml.*;
import org.eclipse.emf.codegen.util.*;

public class Finder
{
  protected static String nl;
  public static synchronized Finder create(String lineSeparator)
  {
    nl = lineSeparator;
    Finder result = new Finder();
    nl = null;
    return result;
  }

  public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
  protected final String TEXT_1 = "";
  protected final String TEXT_2 = "/*" + NL + " * ============================================================================" + NL + " *                   GNU Lesser General Public License" + NL + " * ============================================================================" + NL + " */" + NL + "package ";
  protected final String TEXT_3 = ".editor;";
  protected final String TEXT_4 = NL;
  protected final String TEXT_5 = NL;
  protected final String TEXT_6 = NL + NL + "/**" + NL + " * The local interface for a Finder user interface." + NL + " *" + NL + " * @author ";
  protected final String TEXT_7 = NL + " * @generated" + NL + " */" + NL + "@Local" + NL + "public interface ";
  protected final String TEXT_8 = "Finder extends AbstractFinder< ";
  protected final String TEXT_9 = " > {" + NL;
  protected final String TEXT_10 = NL + "   /** @generated */" + NL + "   PieChart get";
  protected final String TEXT_11 = "PieChart();";
  protected final String TEXT_12 = "   " + NL;
  protected final String TEXT_13 = NL + "   /** @generated */" + NL + "   PieChart get";
  protected final String TEXT_14 = "PieChart();";
  protected final String TEXT_15 = "   " + NL + "}";
  protected final String TEXT_16 = NL;

  public String generate(Object argument)
  {
    final StringBuffer stringBuffer = new StringBuffer();
    

    org.eclipse.uml2.uml.Class uml2Class = (org.eclipse.uml2.uml.Class) argument;org.eclipse.uml2.uml.Package uml2Package = uml2Class.getPackage();
    stringBuffer.append(TEXT_1);
    stringBuffer.append(TEXT_2);
    stringBuffer.append(NameHelper.getQualifiedName(uml2Package));
    stringBuffer.append(TEXT_3);
    ImportManager importManager = ImportHelper.makeImportManager("");
    ImportHelper.addImport(uml2Class);
    stringBuffer.append(TEXT_4);
    importManager.addImport("javax.ejb.Local");
    importManager.addImport("rad.framework.seam.AbstractFinder");
    stringBuffer.append(TEXT_5);
    
StringBuffer importStringBuffer = stringBuffer;
int importInsertionPoint = stringBuffer.length();
importManager.addCompilationUnitImports(stringBuffer.toString());

    stringBuffer.append(TEXT_6);
    stringBuffer.append(System.getProperty("user.name"));
    stringBuffer.append(TEXT_7);
    stringBuffer.append(NameHelper.getCapName(uml2Class));
    stringBuffer.append(TEXT_8);
    stringBuffer.append(NameHelper.getCapName(uml2Class));
    stringBuffer.append(TEXT_9);
    for (Iterator<Property> i=EnumerationHelper.getAllEnumerations(uml2Class); i.hasNext();) { Property property = i.next();
    importManager.addImport("rad.framework.seam.PieChart");
    stringBuffer.append(TEXT_10);
    stringBuffer.append(NameHelper.getCapName(property));
    stringBuffer.append(TEXT_11);
    }
    stringBuffer.append(TEXT_12);
    for (Iterator<Property> l=ClassHelper.getAllManyToOneProperties(uml2Class); l.hasNext();) { Property property = l.next();
    if (!ClassHelper.isComposite(property)) {
    importManager.addImport("rad.framework.seam.PieChart");
    stringBuffer.append(TEXT_13);
    stringBuffer.append(NameHelper.getCapName(property));
    stringBuffer.append(TEXT_14);
    }}
    stringBuffer.append(TEXT_15);
    importStringBuffer.insert(importInsertionPoint, importManager.computeSortedImports());
    stringBuffer.append(TEXT_16);
    return stringBuffer.toString();
  }
}
